package com.lagou.products.service.impl;

import com.lagou.domain.Products;
import com.lagou.products.mapper.ProductsMapper;
import com.lagou.products.service.ProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProductsServiceImpl implements ProductsService {
    @Autowired
    private ProductsMapper productsMapper;

    /**
     * 新增商品信息
     * @param products
     * @return
     */
    @Override
    public Integer addProducts(Products products) {
        int affectNum = productsMapper.insert(products);
        return affectNum;
    }

    /**
     * 根据id查询商品信息
     * @param id
     * @return
     */
    @Override
    public Products getProductsById(Integer id) {
        Products products = productsMapper.selectById(id);
        return products;
    }
}
